package com.heima.springdemo4;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Value("${name}")
    private String name;

    @Value("${person.age}")
    private int age;

    @Value("${person.name}")
    private String name2;

    @Value("${address[0]}")
    private String address;

    @Autowired
    private Person person;

    @RequestMapping("/hello")
    public String hello(){
        System.out.println(name2+" "+age+" "+address);
        System.out.println(person.getName()+" "+person.getAge());
        return "123";
    }
}
